package com.dfbz.dao;

import com.dfbz.dao.basedao.BaseDao;
import com.dfbz.model.Dept;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;
import java.util.Map;

public class DeptDao extends BaseDao<Dept> {

    private JdbcTemplate jdbcTemplate = getJdbcTemplate();


    public DeptDao(Class<Dept> deptClass) {
        super(deptClass);
    }

    public List<Map<String, Object>> findAllDept() {

        String sql="select d.id as deptId,d.name as deptName,u.id as uId,u.username,u.real_name as realName from dept d left join user u on d.id = u.dept_id";

        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        return maps;

    }


}
